/**
 * @author: 團長
 * @date: 2013-5-14-下午6:00:21
 */
package net.loyintean.pearlshell.basedb.dao;

import java.sql.SQLException;
import java.util.List;

import net.loyintean.pearlshell.basedb.dto.BaseDto;

/** 数据库基本操作接口
 * <p>
 * <strong>NOTE</strong><br>
 * 2014-2-24 Loy: each method has a default statement id, so you might use the
 * default implements without sql configuration. usually, the id is full class
 * name of T plus "." and method name. v1.1.0<br>
 * For example, if T's full class name is "test.t", then the default id of
 * {@link #insertSingleDto(BaseDto)} and {@link #deleteSingleDto(BaseDto)} is
 * "test.t.insertSingleDto" and "test.t.deleteSingleDto".
 * 
 * @author 團長
 * @since 2014-2-24
 * @version 1.1.0 */
public interface BasicDao<T> {

	/** 增
	 * 
	 * @author 團長
	 * @since 2014-2-24
	 * @param dto
	 *            if the field saveSingleDto is blank, the default value
	 *            dto.getClass().getName() + ".insertSingleDto" will be
	 *            assigned.
	 * @return
	 * @throws SQLException */
	public int insertSingleDto(T dto, String sql) throws SQLException;

	/** 删
	 * 
	 * @author 團長
	 * @since 2014-2-24
	 * @param dto
	 *            if the field removeSingleDto is blank, the default value
	 *            dto.getClass().getName() + ".deleteSingleDto" will be assigned
	 * @return
	 * @throws SQLException */
	public int deleteSingleDto(T dto, String sql) throws SQLException;

	/** 改
	 * 
	 * @author 團長
	 * @since 2014-2-24
	 * @param dto
	 *            if the field editSingleDto is blank, the default value
	 *            dto.getClass().getName() + ".updateSingleDto" will be assigned
	 * @return
	 * @throws SQLException */
	public int updateSingleDto(T dto, String sql) throws SQLException;

	/** 查——查一个
	 * 
	 * @author 團長
	 * @since 2014-2-24
	 * @param dto
	 *            if the field querySingleDto is blank, the default value
	 *            dto.getClass().getName() + ".selectSingleDto" will be assigned
	 * @return
	 * @throws SQLException */
	public T selectSingleDto(T dto, String sql) throws SQLException;

	/** 查——查完整列表
	 * 
	 * @author 團長
	 * @since 2014-2-24
	 * @param dto
	 *            if the field queryDtoList is blank, the default value
	 *            dto.getClass().getName() + ".selectDtoList" will be assigned
	 * @return
	 * @throws SQLException */
	public List<T> selectDtoList(T dto, String sql) throws SQLException;

	/** 查——查分页列表
	 * 
	 * @author 團長
	 * @since 2014-2-24
	 * @param dto
	 *            if the field queryPagedList is blank, the default value
	 *            dto.getClass().getName() + ".selectPagedList" will be assigned
	 * @return
	 * @throws SQLException */
	public List<T> selectPagedList(T dto, String sql) throws SQLException;

	/** 查——数据库数据总量
	 * 
	 * @author 團長
	 * @since 2014-2-24
	 * @param dto
	 *            if the field queryTotalCount is blank, the default value
	 *            dto.getClass().getName() + ".selectTotalCount" will be
	 *            assigned
	 * @return
	 * @throws SQLException */
	public int selectTotalCount(T dto, String sql) throws SQLException;
}
